from pathlib import Path

# 相对路径
path = Path('day14/pi_digits.txt')  # 程序文件存储在ptthon_work中,
                                    # Python只会在python_work中查找
contents = path.read_text()
contents = contents.rstrip()        # 删除多出来的空格,
                                    # 也可这样写：contents = path.read_text().restrip()
print(contents)

lines = contents.splitlines()
for line in lines:
    print(line)